:root { --bg-color: #121212; /* A deep, rich black */ --pane-bg: #1A1A1A; /* Slightly lighter for the panes */ --card-bg: #242424; /* Background for cards */ --text-primary: #EAEAEA; /* A soft, readable white */ --text-secondary: #A0A0A0; /* Gray for subtitles and less important text */ --accent-gold: #559fd8; /* A rich, elegant gold */ --border-color: #333333; /* Subtle border color */ --shadow-color: rgba(0, 0, 0, 0.4); } .portfolio-container { display: grid; grid-template-columns: 1fr; max-width: 1400px; margin: auto; direction: rtl; } @media (min-width: 1024px) { .portfolio-container { grid-template-columns: 30% 70%; min-height: 100vh; } } /* Left Pane (Fixed) */ .left-pane { background-color: #1a1a1ac9; padding: 30px; display: flex; flex-direction: column; align-items: center; text-align: center; border-left: 1px solid var(--border-color); /* For RTL */ } @media (min-width: 1024px) { .left-pane { position: sticky; top: 0; height: 79vh; border-radius: 61px; justify-content: center; } } .author-avatar { position: relative; width: fit-content !important; height: fit-content !important; } .profile-pic { width: 200px !important; height: 200px !important; border-radius: 50% !important; object-fit: cover !important; border: 5px solid var(--card-bg) !important; margin-right: 0px !important; box-shadow: 0 0 25px var(--shadow-color) !important; } @keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .left-pane h1 { font-size: 2rem; font-weight: 700; font-family: 'cairo'; color: var(--text-primary); margin-bottom: 30px; } .left-pane h2 { font-size: 1.2rem; font-weight: 400; color: var(--accent-gold); margin-bottom: 25px; } .contact-button { padding: 15px 12px; border-radius: 5px; font-size: 0.9rem; font-weight: bold; font-family: var(--font-main); cursor: pointer; background-color: var(--text-primary); color: var(--bg-page); width: 90%; margin-top: 10px; max-width: 257px; border: 1px solid var(--text-primary); transition: all 0.2s ease; } .contact-button:hover { background-color: var(--bg-page); color: var(--text-primary); } /* Right Pane (Scrollable) */ .right-pane { padding: 30px; overflow-y: auto; padding-top: 5px; } @media(max-width:600px){ .right-pane { padding: 15px; } } .section { margin-bottom: 60px; } .section-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 2px solid var(--border-color); position: relative; display: block; color: #fff; font-family: 'cairo'; } .section-title::after { content: ''; position: absolute; bottom: -2px; right: 0; /* For RTL */ width: 70px; height: 2px; background-color: var(--accent-gold); } .about-text p { font-size: 19px; line-height: 1.8; font-family: 'zain'; color: var(--text-secondary); margin-bottom: 15px; font-weight: bold; } /* Expertise Section */ .expertise-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; } .expertise-card { background-color: var(--card-bg); padding: 30px; border-radius: 10px; border: 1px solid var(--border-color); transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; } .expertise-card:hover { transform: translateY(-5px); border-color: var(--accent-gold); box-shadow: 0 10px 30px var(--shadow-color); } .expertise-card .icon { font-size: 2.5rem; color: var(--accent-gold); margin-bottom: 20px; display: flex ; align-items: center; gap: 8px; } .expertise-card h3 { font-size: 1.4rem; color: var(--text-primary); font-family: 'zain'; display: inline !important; } .expertise-card p { color: var(--text-secondary); font-size: 0.95rem; } /* Testimonials Section */ .testimonial-card { background: var(--card-bg); padding: 30px; border-radius: 10px; border-right: 4px solid var(--accent-gold); /* For RTL */ box-shadow: 0 5px 20px var(--shadow-color); } .testimonial-card blockquote { font-size: 1.1rem; font-style: italic; color: var(--text-secondary); border: none; padding: 0; margin-bottom: 20px; } .testimonial-card footer { font-weight: 600; color: var(--text-primary); } .testimonial-card footer span { display: block; font-weight: 400; color: var(--accent-gold); font-size: 0.9rem; margin-top: 5px; } ZTX4Kdc7BsbEUxbBpprzQn7DgFM2 عبدالرحمن محمد حنفي درجة القيد ... سنوات الخبرة ... طلب استشارة نبذة عني مجالات الخبرة قضايا قانونية جاري تحميل القضايا... عرض المزيد من القضايا تقييمات العملاء document.addEventListener("DOMContentLoaded", function() { const blogUrl = "https://www.egquiz.com"; const label = "ZTX4Kdc7BsbEUxbBpprzQn7DgFM2"; const resultsPerPage = 8; // عدد القضايا في كل صفحة const maxPostsToFetch = 500; // الحد الأقصى للقضايا لجلبها (حد API) const gridContainer = document.querySelector(".cases-grid"); const loadMoreBtn = document.getElementById("loadMoreBtn"); const loadMoreContainer = document.querySelector(".load-more-container"); const searchInput = document.getElementById("searchInput"); let allCases = []; // مصفوفة لتخزين جميع القضايا let displayedCount = 0; // عدد القضايا المعروضة حاليًا // 1. دالة لإنشاء البطاقة (بدون تغيير) function createCaseCard(post) { const postTitle = post.title.$t; let postUrl = '#'; if (post.link) { for (let i = 0; i < post.link.length; i++) { if (post.link[i].rel === 'alternate') { postUrl = post.link[i].href; break; } } } const contentHtml = post.content ? post.content.$t : ''; const tempDiv = document.createElement('div'); tempDiv.innerHTML = contentHtml; const descriptionElement = tempDiv.querySelector('pre.case-description'); const description = descriptionElement ? descriptionElement.textContent : "لا يتوفر وصف..."; post.searchableDescription = description.toLowerCase(); // إضافة الوصف للبحث const publishedDate = new Date(post.published.$t); const formattedDate = new Intl.DateTimeFormat('ar-EG', { day: 'numeric', month: 'long', year: 'numeric' }).format(publishedDate); const caseCard = document.createElement('article'); caseCard.className = 'case-card'; caseCard.innerHTML = ` ${postTitle}${description} نشر في: ${formattedDate} التفاصيل `; return caseCard; } // 2. دالة لعرض مجموعة من القضايا function displayCases(cases) { cases.forEach(caseData => { const card = createCaseCard(caseData); gridContainer.appendChild(card); }); } // 3. دالة "عرض المزيد" function loadMoreCases() { const remainingCases = allCases.slice(displayedCount, displayedCount + resultsPerPage); displayCases(remainingCases); displayedCount += remainingCases.length; // إخفاء الزر إذا لم يعد هناك المزيد لعرضه if (displayedCount >= allCases.length) { loadMoreContainer.style.display = 'none'; } } // 4. وظيفة البحث searchInput.addEventListener('input', function() { const searchTerm = this.value.toLowerCase().trim(); if (searchTerm === "") { gridContainer.innerHTML = ''; displayedCount = 0; loadMoreCases(); // *** التصحيح هنا أيضاً: إظهار الزر عند مسح البحث *** if (allCases.length > displayedCount) { loadMoreContainer.style.display = 'block'; } return; } const filteredCases = allCases.filter(caseData => { const title = caseData.title.$t.toLowerCase(); const description = caseData.searchableDescription || ""; return title.includes(searchTerm) || description.includes(searchTerm); }); gridContainer.innerHTML = ''; loadMoreContainer.style.display = 'none'; if (filteredCases.length > 0) { displayCases(filteredCases); } else { gridContainer.innerHTML = 'لم يتم العثور على نتائج.'; } }); // 5. جلب جميع القضايا عند تحميل الصفحة function fetchAllCases() { const apiUrl = `${blogUrl}/feeds/posts/default/-/${encodeURIComponent(label)}?alt=json-in-script&max-results=${maxPostsToFetch}&callback=processAllCases`; window.processAllCases = function(data) { allCases = data.feed.entry || []; gridContainer.innerHTML = ''; if (allCases.length > 0) { loadMoreCases(); // عرض أول دفعة من القضايا // *** ⭐ التصحيح الرئيسي هنا ⭐ *** // بعد عرض الدفعة الأولى، تحقق إذا كان هناك المزيد لإظهار الزر if (allCases.length > displayedCount) { loadMoreContainer.style.display = 'block'; } } else { gridContainer.innerHTML = 'لا توجد قضايا لعرضها حاليًا.'; loadMoreContainer.style.display = 'none'; } }; const script = document.createElement('script'); script.src = apiUrl; document.body.appendChild(script); script.onload = () => document.body.removeChild(script); } loadMoreBtn.addEventListener('click', loadMoreCases); fetchAllCases(); }); // ================================================================= // القسم الأول: الاستيراد والتهيئة (يتم مرة واحدة فقط) // ================================================================= // 1. دمج جميع دوال Firebase المطلوبة في استيراد واحد import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-app.js"; import { getFirestore, doc, getDoc, updateDoc, collection, addDoc } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-firestore.js"; import { getAuth, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-auth.js"; // 2. تعريف وتهيئة Firebase مرة واحدة فقط const firebaseConfig = { apiKey: "AIzaSyCXUgLNYwKB9_wrOONQOrD8mlO2zdp4tuc", authDomain: "derby1.firebaseapp.com", projectId: "derby1", storageBucket: "derby1.appspot.com", messagingSenderId: "839166015287", appId: "1:839166015287:web:786225f8220461ea9d0cb2" }; const app = initializeApp(firebaseConfig); const db = getFirestore(app); const auth = getAuth(app); // ================================================================= // القسم الثاني: تعريف الدوال والوظائف // ================================================================= // --- دالة إنشاء نافذة "طلب استشارة" (من الكود الأول) --- function createAndShowModal(targetLawyerUid, targetLawyerName) { const modalOverlay = document.createElement('div'); modalOverlay.id = 'consultationModal'; modalOverlay.className = 'modal-overlay'; modalOverlay.innerHTML = ` × طلب استشارة من المحامي موضوع الاستشارة * نص الاستشارة * رقم القضية (إن وجد) رقم الهاتف (لإثبات الجدية) * إرسال الاستشارة `; document.body.appendChild(modalOverlay); setTimeout(() => modalOverlay.classList.add('show'), 10); const consultationForm = document.getElementById('consultationForm'); const submitBtn = document.getElementById('submitConsultationBtn'); const closeModalBtn = document.getElementById('closeModalBtn'); const hideAndRemoveModal = () => { modalOverlay.classList.remove('show'); setTimeout(() => { modalOverlay.remove(); }, 300); }; closeModalBtn.addEventListener('click', hideAndRemoveModal); modalOverlay.addEventListener('click', (e) => { if (e.target === modalOverlay) { hideAndRemoveModal(); } }); consultationForm.addEventListener('submit', async (e) => { e.preventDefault(); const user = auth.currentUser; if (!user) { alert("انتهت صلاحية جلسة تسجيل الدخول. يرجى تسجيل الدخول مرة أخرى."); return; } submitBtn.disabled = true; submitBtn.textContent = 'جاري الإرسال...'; try { const consultationData = { subject: document.getElementById('consultSubject').value, details: document.getElementById('consultDetails').value, caseNumber: document.getElementById('consultCaseNumber').value || '', phone: document.getElementById('consultPhone').value, status: 'pending', createdAt: new Date(), senderUid: user.uid, senderName: user.displayName || 'مستخدم غير معروف', senderPhoto: user.photoURL || '', lawyerUid: targetLawyerUid, lawyerName: targetLawyerName, participants: [user.uid, targetLawyerUid] }; await addDoc(collection(db, "requestToLawyers"), consultationData); alert('تم إرسال استشارتك بنجاح!'); hideAndRemoveModal(); } catch (error) { console.error("Error sending consultation:", error); alert('حدث خطأ. يرجى المحاولة مرة أخرى.'); } finally { submitBtn.disabled = false; submitBtn.textContent = 'إرسال الاستشارة'; } }); } // --- مصدر بيانات لكل مجالات الخبرة المتاحة (من الكود الثاني) --- const allExpertiseOptions = [ { id: 'companies', title: 'قانون الشركات', icon: 'fas fa-landmark', description: 'تأسيس، دمج، واستحواذ. صياغة عقود الشراكة وحوكمة الشركات.' }, { id: 'litigation', title: 'التقاضي والتحكيم', icon: 'fas fa-balance-scale', description: 'تمثيل العملاء أمام جميع درجات المحاكم والهيئات القضائية والتحكيمية.' }, { id: 'commercial', title: 'العقود التجارية', icon: 'fas fa-briefcase', description: 'صياغة ومراجعة كافة أنواع العقود التجارية المحلية والدولية.' }, { id: 'criminal', title: 'القانون الجنائي', icon: 'fas fa-gavel', description: 'الدفاع في القضايا الجنائية المختلفة مع التركيز على جرائم الأموال.' }, { id: 'real_estate', title: 'العقاري والإنشاءات', icon: 'fas fa-city', description: 'تسجيل العقارات، عقود المقاولات، والنزاعات العقارية.' }, { id: 'labor', title: 'قانون العمل', icon: 'fas fa-users', description: 'عقود العمل، تسوية النزاعات العمالية، وتمثيل الشركات والموظفين.' }, { id: 'ip', title: 'الملكية الفكرية', icon: 'far fa-lightbulb', description: 'تسجيل العلامات التجارية وبراءات الاختراع وحماية حقوق المؤلف.' }, { id: 'banking', title: 'البنوك والتمويل', icon: 'fas fa-university', description: 'التمويل الإسلامي، القروض، والامتثال التنظيمي للبنوك.' } ]; // --- دالة جلب بيانات المحامي وعرضها (من الكود الثاني) --- async function fetchLawyerDetails() { const avatarImg = document.querySelector('.lawyer-card .profile-pic'); const nameEl = document.querySelector('.lawyer-card .lawyer-name'); const descriptionEl = document.getElementById('lawyer-description'); const degreeSpan = document.getElementById('degree-value'); const expertiseSpan = document.getElementById('expertise-value'); const uidElement = document.getElementById('cli-n-fix'); const aboutTextP = document.querySelector('.about-text p'); const expertiseGrid = document.querySelector('.expertise-grid'); if (!uidElement) { console.error("خطأ: لم يتم العثور على عنصر UID."); return; } const lawyerUid = uidElement.textContent.trim(); if (!lawyerUid) return; try { const lawyerDocRef = doc(db, "contactForm", lawyerUid); const docSnap = await getDoc(lawyerDocRef); if (docSnap.exists()) { const lawyerData = docSnap.data(); if (avatarImg) avatarImg.src = lawyerData.photoUrlXP || 'https://placehold.co/120x120/EFEFEF/AAAAAA&text=صورة'; if (nameEl) nameEl.textContent = lawyerData.msgContent || 'اسم غير متوفر'; if (descriptionEl) descriptionEl.textContent = lawyerData.descriptionrw || 'لا يوجد وصف متاح.'; if (degreeSpan) degreeSpan.textContent = lawyerData.degree || 'غير محدد'; if (expertiseSpan) expertiseSpan.textContent = lawyerData.expertise || 'غير محدد'; if (aboutTextP) aboutTextP.textContent = lawyerData.descriptionrw || 'لا يوجد نبذة متاحة.'; const renderExpertise = (expertiseList) => { expertiseGrid.innerHTML = ''; if (expertiseList && expertiseList.length > 0) { expertiseList.forEach(item => { const card = document.createElement('div'); card.className = 'expertise-card'; card.innerHTML = ` ${item.title} ${item.description} `; expertiseGrid.appendChild(card); }); } else { expertiseGrid.innerHTML = ` لا توجد مجالات خبره محدده `; } }; renderExpertise(lawyerData.exLawMad); onAuthStateChanged(auth, (user) => { if (document.getElementById('edit-description-btn')) { return; } const isOwner = user && user.uid === lawyerUid; const container = aboutTextP.parentElement; if (container) { const editButton = document.createElement('button'); editButton.id = 'edit-description-btn'; editButton.textContent = 'تعديل الوصف'; editButton.style.fontFamily = 'zain'; editButton.style.padding = '5px 10px'; editButton.style.background = '#2c2c2c'; editButton.style.borderRadius = '81px'; editButton.style.fontSize = '15px'; editButton.style.border = '1px solid #494949'; const editContainer = document.createElement('div'); editContainer.id = 'edit-container'; editContainer.style.display = 'none'; editContainer.style.marginTop = '10px'; const descriptionTextarea = document.createElement('textarea'); descriptionTextarea.rows = 4; descriptionTextarea.style.width = '100%'; const saveButton = document.createElement('button'); saveButton.textContent = 'حفظ'; saveButton.style.fontFamily = 'zain'; saveButton.style.padding = '5px 10px'; saveButton.style.background = '#2c2c2c'; saveButton.style.borderRadius = '81px'; saveButton.style.fontSize = '15px'; saveButton.style.border = '1px solid #494949'; const cancelButton = document.createElement('button'); cancelButton.textContent = 'إلغاء'; cancelButton.style.marginRight = '5px'; cancelButton.style.fontFamily = 'zain'; cancelButton.style.padding = '5px 10px'; cancelButton.style.background = '#2c2c2c'; cancelButton.style.borderRadius = '81px'; cancelButton.style.fontSize = '15px'; cancelButton.style.border = '1px solid #494949'; editContainer.appendChild(descriptionTextarea); editContainer.appendChild(saveButton); editContainer.appendChild(cancelButton); container.appendChild(editButton); container.appendChild(editContainer); if (user && user.uid === lawyerUid) { editButton.disabled = false; editButton.addEventListener('click', () => { aboutTextP.style.display = 'none'; editContainer.style.display = 'block'; descriptionTextarea.value = aboutTextP.textContent; editButton.style.display = 'none'; }); cancelButton.addEventListener('click', () => { aboutTextP.style.display = 'block'; editContainer.style.display = 'none'; editButton.style.display = 'block'; }); saveButton.addEventListener('click', async () => { const newDescription = descriptionTextarea.value; await updateDoc(lawyerDocRef, { descriptionrw: newDescription }); aboutTextP.textContent = newDescription; if (descriptionEl) descriptionEl.textContent = newDescription; aboutTextP.style.display = 'block'; editContainer.style.display = 'none'; editButton.style.display = 'block'; }); } else { editButton.disabled = true; editButton.title = "التعديل متاح لصاحب الحساب فقط"; } } const expertiseContainerParent = expertiseSpan.parentElement; if (expertiseContainerParent) { const editExpertiseBtn = document.createElement('button'); editExpertiseBtn.id = 'edit-expertise-btn'; editExpertiseBtn.textContent = 'تعديل'; editExpertiseBtn.style.marginRight = '10px'; editExpertiseBtn.style.fontFamily = 'zain'; editExpertiseBtn.style.padding = '5px 10px'; editExpertiseBtn.style.background = '#2c2c2c'; editExpertiseBtn.style.borderRadius = '81px'; editExpertiseBtn.style.fontSize = '15px'; editExpertiseBtn.style.border = '1px solid #494949'; const editExpertiseContainer = document.createElement('div'); editExpertiseContainer.style.display = 'none'; const expertiseInput = document.createElement('input'); expertiseInput.type = 'text'; expertiseInput.style.color = '#fff'; const saveExpertiseBtn = document.createElement('button'); saveExpertiseBtn.textContent = 'حفظ'; saveExpertiseBtn.style.fontFamily = 'zain'; saveExpertiseBtn.style.padding = '5px 10px'; saveExpertiseBtn.style.background = '#2c2c2c'; saveExpertiseBtn.style.borderRadius = '81px'; saveExpertiseBtn.style.fontSize = '15px'; saveExpertiseBtn.style.border = '1px solid #494949'; const cancelExpertiseBtn = document.createElement('button'); cancelExpertiseBtn.textContent = 'إلغاء'; cancelExpertiseBtn.style.fontFamily = 'zain'; cancelExpertiseBtn.style.padding = '5px 10px'; cancelExpertiseBtn.style.background = '#2c2c2c'; cancelExpertiseBtn.style.borderRadius = '81px'; cancelExpertiseBtn.style.fontSize = '15px'; cancelExpertiseBtn.style.border = '1px solid #494949'; editExpertiseContainer.appendChild(expertiseInput); editExpertiseContainer.appendChild(saveExpertiseBtn); editExpertiseContainer.appendChild(cancelExpertiseBtn); expertiseSpan.after(editExpertiseBtn, editExpertiseContainer); if (user && user.uid === lawyerUid) { editExpertiseBtn.disabled = false; editExpertiseBtn.addEventListener('click', () => { expertiseSpan.style.display = 'none'; editExpertiseContainer.style.display = 'inline-block'; expertiseInput.value = expertiseSpan.textContent; editExpertiseBtn.style.display = 'none'; }); cancelExpertiseBtn.addEventListener('click', () => { expertiseSpan.style.display = 'inline-block'; editExpertiseContainer.style.display = 'none'; editExpertiseBtn.style.display = 'inline-block'; }); saveExpertiseBtn.addEventListener('click', async () => { const newExpertise = expertiseInput.value; await updateDoc(lawyerDocRef, { expertise: newExpertise }); expertiseSpan.textContent = newExpertise; expertiseSpan.style.display = 'inline-block'; editExpertiseContainer.style.display = 'none'; editExpertiseBtn.style.display = 'inline-block'; }); } else { editExpertiseBtn.disabled = true; } } const sectionTitle = document.querySelector('#expertise .section-title'); if (sectionTitle && (user && user.uid === lawyerUid)) { const editExpertiseAreasBtn = document.createElement('button'); editExpertiseAreasBtn.textContent = 'تعديل مجالات الخبرة'; editExpertiseAreasBtn.style.marginRight = '20px'; editExpertiseAreasBtn.style.fontFamily = 'zain'; editExpertiseAreasBtn.style.padding = '5px 10px'; editExpertiseAreasBtn.style.background = '#2c2c2c'; editExpertiseAreasBtn.style.borderRadius = '81px'; editExpertiseAreasBtn.style.fontSize = '15px'; editExpertiseAreasBtn.style.border = '1px solid #494949'; sectionTitle.appendChild(editExpertiseAreasBtn); editExpertiseAreasBtn.addEventListener('click', () => { openExpertiseModal(lawyerData.exLawMad || []); }); } const openExpertiseModal = (savedExpertise) => { const modalBackdrop = document.createElement('div'); modalBackdrop.style.cssText = `position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 1000;`; const modalContent = document.createElement('div'); modalContent.style.cssText = `background: #333; color: #fff; padding: 20px; border-radius: 8px; width: 80%; max-width: 600px; max-height: 80vh; overflow-y: auto;`; modalContent.innerHTML = `اختر مجالات خبرتك`; const form = document.createElement('form'); allExpertiseOptions.forEach(option => { const isChecked = savedExpertise.some(saved => saved.id === option.id); const itemDiv = document.createElement('div'); itemDiv.style.marginBottom = '10px'; itemDiv.innerHTML = ` ${option.title}`; form.appendChild(itemDiv); }); modalContent.appendChild(form); const saveBtn = document.createElement('button'); saveBtn.textContent = 'حفظ'; const cancelBtn = document.createElement('button'); cancelBtn.textContent = 'إلغاء'; modalContent.append(saveBtn, cancelBtn); modalBackdrop.appendChild(modalContent); document.body.appendChild(modalBackdrop); const closeModal = () => document.body.removeChild(modalBackdrop); cancelBtn.onclick = closeModal; modalBackdrop.onclick = (e) => { if (e.target === modalBackdrop) closeModal(); }; saveBtn.onclick = async () => { const selectedIds = Array.from(form.querySelectorAll('input:checked')).map(input => input.value); const newExpertiseList = allExpertiseOptions.filter(option => selectedIds.includes(option.id)); saveBtn.textContent = 'جارٍ الحفظ...'; saveBtn.disabled = true; await updateDoc(lawyerDocRef, { exLawMad: newExpertiseList }); renderExpertise(newExpertiseList); lawyerData.exLawMad = newExpertiseList; closeModal(); }; }; }); } else { if (nameEl) nameEl.textContent = 'المحامي غير موجود'; } } catch (error) { console.error("حدث خطأ أثناء جلب البيانات:", error); if (nameEl) nameEl.textContent = 'خطأ في التحميل'; } } // --- دالة لإعداد زر "طلب استشارة" --- function setupConsultationButton() { const mainConsultButton = document.querySelector('.contact-button'); const lawyerUidElement = document.getElementById('cli-n-fix'); if (mainConsultButton && lawyerUidElement) { mainConsultButton.addEventListener('click', (event) => { event.preventDefault(); const user = auth.currentUser; if (!user) { alert("يرجى تسجيل الدخول أولاً لطلب استشارة."); return; } const targetLawyerUid = lawyerUidElement.textContent.trim(); const lawyerNameElement = document.querySelector('h1'); const targetLawyerName = lawyerNameElement ? lawyerNameElement.textContent.trim() : 'محامي'; createAndShowModal(targetLawyerUid, targetLawyerName); }); } } // ================================================================= // القسم الثالث: تشغيل الكود بعد تحميل الصفحة // ================================================================= document.addEventListener('DOMContentLoaded', () => { fetchLawyerDetails(); setupConsultationButton(); }); body { font-family: 'Cairo', sans-serif; background-color: #f9f9f9; } .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; } .modal-content { direction: rtl;position: relative;background-color: rgb(17, 17, 17);color: rgb(255, 255, 255);padding: 20px 30px;border-radius: 20px;border: 1px solid rgb(58, 58, 58);box-shadow: rgba(0, 0, 0, 0.5) 0px 10px 40px;width: 90%;max-width: 600px;text-align: center;transform: scale(0.9);transition: all 0.2s ease 0s; } .modal-overlay.show { opacity: 1; } .modal-overlay.show .modal-content { transform: scale(1); } .modal-close-btn { position: absolute; top: 15px; right: auto; left: 15px !important; background: none; border: none; font-size: 28px; cursor: pointer; color: #aaa; line-height: 1; } #consultationForm .form-group { margin-bottom: 15px; } #consultationForm label { display: block; margin-bottom: 5px; font-weight: 600; color: #fff; text-align: right; font-family: 'cairo'; font-size: 15px; } #consultationForm input, #consultationForm textarea { width: 100%; padding: 12px; border: 1px solid #ffffff1c; border-radius: 8px; box-sizing: border-box; background: #191919; border-radius: 126px; font-family: 'zain'; font-size: 16px; color: #fff !important;} #consultationForm input:focus, #consultationForm textarea:focus { border-color: #007bff; outline: none; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1); } .btn-submit { width: 55%; padding: 12px; border-radius: 23px; font-size: 1.1em; font-weight: 600; cursor: pointer; transition: background-color 0.2s; background-color: #000000; color: white; font-family: 'zain'; border: 1px solid #ffffff4a; } .btn-submit:hover { background-color: #fff; color: #000; } .btn-submit:disabled { background-color: #94d3a2; cursor: not-allowed; }